<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Living Web - Large File Upload</title>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	</head>
  <body>

<?php
	include("../../CommonClasses/Properties.php");

	$config_file = fopen("thinftp.properties","r+w+");
	$ftp_config = new Properties();
	$ftp_config->load($config_file);

	$ftp_username = null;
    if (isset($_COOKIE['MID']) && $_COOKIE['MID'] != '') {
    	$ftp_username = strtolower($_COOKIE['MID'])."_ftp@lwbc.net";
		$ftp_config->setProperty("default_user",$ftp_username);
		$ftp_config->setProperty("default_only","yes");
		$ftp_config->store($config_file);
    }
   else {
		exceptionDisplay();
    }

	$user_agent = $_SERVER['HTTP_USER_AGENT'];

	if(stristr($user_agent,"konqueror") || stristr($user_agent,"macintosh") || stristr($user_agent,"opera"))
	{
		echo '<applet name="Thin FTP"
				archive="ThinFTPDemo.jar"
				code="com.thinfile.ftp.ThinFTPAppletDemo"
				width="710"
				height="415">
			 </applet>';
	}
	else
	{
		if(strstr($user_agent,"MSIE"))
		{
            echo '<script language="javascript" src="embed.js" type="text/javascript"></script>';
            echo '<script>IELoader()</script>';
		} else {
			echo '<object type="application/x-java-applet;version=1.4.2"
				width= "710" height= "415" >';
            echo '<param name="archive" value = "ThinFTPDemo.jar">
                <param name="code" value = "com.thinfile.ftp.ThinFTPAppletDemo">
                <param name="name" value = "Thin FTP">';
		}
		echo '</object>';
	}

  function exceptionDisplay() {
    	print('There was an error in loading this page.  ' .
			'Attempt to remedy this by completely closing the ' .
			'browser and trying to access this page again.  If you still see this error, then there is either a technical ' .
			'error or your browser\'s cookies are not enabled.');
    	exit();
  }
  
?>
</body>
</html>